const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  entry: ['./src/fp_upload/index.js', './src/fp_upload/woker.js'],
  output: {
    filename: "[name].[chunkhash:8].js",      // JS 用 chunkhash
  },
  module: {
    rules: [
      {
        test: /.woker.js$/,  // 匹配所有的xxx.worker.js
        loader: 'worker-loader'
      }
    ]
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: "./src/fp_upload/index.html",
    })
  ],
  watch: true,
  mode: "development",
};
